package cn.org.eshow.service.impl;

import cn.org.eshow.bean.query.WithdrawQuery;
import cn.org.eshow.common.page.Page;
import cn.org.eshow.dao.WithdrawDao;
import cn.org.eshow.model.Withdraw;
import cn.org.eshow.service.WithdrawManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jws.WebService;
import java.util.List;

@WebService(serviceName = "WithdrawManager", endpointInterface = "cn.org.eshow.service.WithdrawManager")
@Service
public class WithdrawManagerImpl extends GenericManagerImpl<Withdraw, Integer> implements WithdrawManager {

    @Autowired
    private WithdrawDao withdrawDao;

    @Autowired
    public WithdrawManagerImpl(WithdrawDao withdrawDao) {
        super(withdrawDao);
        this.withdrawDao = withdrawDao;
    }

    public WithdrawManagerImpl() {
    }

    @Override
    public List<Withdraw> list(WithdrawQuery query) {
        return withdrawDao.list(query);
    }

    @Override
    public List<Withdraw> list(String hql, Object[] params) {
        return withdrawDao.list(hql, params);
    }

    @Override
    public Page<Withdraw> search(WithdrawQuery query) {
        return withdrawDao.search(query);
    }

    @Override
    public Withdraw check(WithdrawQuery query) {
        List<Withdraw> list = list(query);
        if (!list.isEmpty()) {
            return list.get(0);
        }
        return null;
    }

    @Override
    public Long count(WithdrawQuery query) {
        return withdrawDao.count(query);
    }
}
